//
//  PPMeInfoTextCell.m
//  PropertyManage
//
//  Created by Dreamsoul on 15-3-25.
//  Copyright (c) 2015年 com.lab603.mc. All rights reserved.
//

#import "PPMeInfoTextCell.h"
#import "PPMeInfoTextCellFrame.h"
#import "PPMe.h"
@interface PPMeInfoTextCell()
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UILabel *contentLabel;
@end
@implementation PPMeInfoTextCell
+ (instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *ID = @"meInfoTextCell";
    PPMeInfoTextCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell = [[PPMeInfoTextCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        //cell.accessoryType = UITableViewCellAccessoryNone;
    }
    return cell;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectedBackgroundView = [[UIView alloc] init];
        //设置背景图片
        UIImageView *backgroundView = [[UIImageView alloc] init];
        backgroundView.image = [UIImage resizedImageWithName:@"timeline_card_top_background"];
        backgroundView.highlightedImage = [UIImage resizedImageWithName: @"timeline_card_top_background_highlighted"
                                           ];
        [self.contentView addSubview:backgroundView];
        self.backgroundView = backgroundView;
        
        //设置标题文字
        UILabel *titleLabel = [[UILabel alloc] init];
        [titleLabel setBackgroundColor:[UIColor clearColor]];
        [titleLabel setTextColor:[UIColor blackColor]];
        titleLabel.numberOfLines = 0;
        titleLabel.font = [UIFont systemFontOfSize:15.0];
        [self.backgroundView addSubview:titleLabel];
        self.titleLabel = titleLabel;
        //设置内容文字
        UILabel *contentLabel = [[UILabel alloc] init];
        [contentLabel setBackgroundColor:[UIColor clearColor]];
        [contentLabel setTextColor:[UIColor lightGrayColor]];
        contentLabel.numberOfLines = 0;
        contentLabel.font = [UIFont systemFontOfSize:14.0];
        [self.backgroundView addSubview:contentLabel];
        self.contentLabel = contentLabel;
        
    }
    return self;
}
-(void)setInfoTextCellF:(PPMeInfoTextCellFrame *)infoTextCellF{
    _infoTextCellF = infoTextCellF;
    //设置frame
    self.titleLabel.frame = infoTextCellF.titleF;
    self.contentLabel.frame = infoTextCellF.contentF;
    self.backgroundView.frame = infoTextCellF.backgroundViewF;
    //设置数据
    PPMe * me = infoTextCellF.me;
    self.titleLabel.text = me.titleString;
    self.contentLabel.text = me.typeString;
}
@end
